{% extends "common/layout_main.html" %}
{% block js %}
    <script src="{{ buildStaticUrl('/js/foods/food_cate.js') }}"></script>
{% endblock %}
{% block content %}
    <div class="row  border-bottom">
        <div class="col-lg-12">
            <div class="tab_title">
                <ul class="nav nav-pills">
                    <li>
                        <a href="{{ buildUrl('/food/index') }}">美食列表</a>
                    </li>
                    <li class="current">
                        <a href="{{ buildUrl('/food/cat') }}?st=1">分类列表</a>
                    </li>
                </ul>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-lg-12">
            <form class="form-inline wrap_search">
                <div class="row  m-t p-w-m">
                    <div class="form-group">
                        <select name="status" class="form-control inline">
                            <option value="-1">请选择状态</option>
                            <option value="1">正常</option>
                            <option value="0">已删除</option>
                        </select>
                    </div>
                </div>
                <hr>
                <div class="row">
                    <div class="col-lg-12">
                        <a class="btn btn-w-m btn-outline btn-primary pull-right"
                           href="{{ buildUrl('/food/cat-set') }}">
                            <i class="fa fa-plus"></i>分类
                        </a>
                    </div>
                </div>

            </form>
            <table class="table table-bordered m-t">
                <thead>
                <tr>
                    <th>序号</th>
                    <th>分类名称</th>
                    <th>状态</th>
                    <th>权重</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                {% if cates|length != 0 %}
                    {% for cate in cates %}
                        <tr>
                            <td>{{ loop.index }}</td>
                            <td>{{ cate.name }}</td>
                            <td>{{ '有效' if cate.status == 1 else '无效' }}</td>
                            <td>{{ cate.weight }}</td>
                            <td>
                                <a class="m-l" href="{{ buildUrl('/food/cat-set') }}?id={{ cate.id }}">
                                    <i class="fa fa-edit fa-lg"></i>
                                </a>

                                <a class="m-l remove" data-id="{{ cate.id }}">
                                    <i class="fa fa-trash fa-lg"></i>
                                </a>
                            </td>
                        </tr>
                    {% endfor %}
                {% else %}
                    <tr>
                        <td colspan="5">暂无数据</td>
                    </tr>
                {% endif %}
                </tbody>
            </table>
        </div>
    </div>
{% endblock %}
